feat(timescaledb): 支持配置TimescaleDB函数所在的schema - #710
Merged
Conversation
PengyuDeng
commented
Nov 5, 2025
Contributor
- 在application.yml和application-default.yml中新增TIMESCALEDB_FUNCTION_SCHEMA配置项
- 修改TimescaleDBCreateTableSqlBuilder类,移除构造函数中的schema参数
- 更新创建超表和保留策略的SQL语句,使用functionSchema替代原有schema
- 在TimescaleDBTimeSeriesManager中注入TimescaleDBProperties并设置FunctionSchema特性
- 调整时间分组列的创建逻辑,支持传入functionSchema参数
- 引入FunctionSchema类管理TimescaleDB相关的函数位置信息
- 在application.yml和application-default.yml中新增TIMESCALEDB_FUNCTION_SCHEMA配置项 - 修改TimescaleDBCreateTableSqlBuilder类,移除构造函数中的schema参数 - 更新创建超表和保留策略的SQL语句,使用functionSchema替代原有schema - 在TimescaleDBTimeSeriesManager中注入TimescaleDBProperties并设置FunctionSchema特性 - 调整时间分组列的创建逻辑,支持传入functionSchema参数 - 引入FunctionSchema类管理TimescaleDB相关的函数位置信息
zhou-hao
reviewed
Nov 5, 2025
| /** | ||
| * TimescaleDB超表函数所在的位置 | ||
| */ | ||
| private String functionSchema = "public"; |
Member
There was a problem hiding this comment.
默认应该为null. 为null时使用schema, 否则只配置了schema的情况下, 可能有问题.
|
|
||
| return NativeSelectColumn | ||
| .of("time_bucket('" + unit + "',timestamp)"); | ||
| .of(functionSchema + ".time_bucket('" + unit + "',timestamp)"); |
|
|
||
| @AllArgsConstructor(staticName = "of") | ||
| @Getter | ||
| public class FunctionSchema implements Feature, FeatureType { |
Member
There was a problem hiding this comment.
建立直接传 TimescaleDBProperties 便于后续拓展
| request.getFrom().getTime(), | ||
| request.getInterval() | ||
| request.getInterval(), | ||
| database.getMetadata().getTable(metric).get().getFeatureNow(FunctionSchema.ID).getFunctionSchema() |
| .ddl() | ||
| .createOrAlter(tableName) | ||
| .custom(table -> { | ||
| table.addFeature(FunctionSchema.of(timescaleDBProperties.getFunctionSchema())); |
Member
There was a problem hiding this comment.
建议创建database 时直接放到 database或者schema中
zhou-hao
reviewed
Nov 5, 2025
| * TimescaleDB超表函数所在的位置 | ||
| */ | ||
| private String functionSchema = "public"; | ||
| private String functionSchema = this.schema; |
| String interval = createHypertable.getInterval().getNumber().intValue() + " " | ||
| + createHypertable.getInterval().getUnit().name().toLowerCase(); | ||
| String functionSchema = table.getFeatureNow(FunctionSchema.ID) | ||
| String functionSchema = table.getSchema() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.